/* eslint-disable no-unused-vars */
/**
 * @author 肖阳
 * @time 2020-9-10
 * @dec 各种节点类
 */
import { HashCode } from "../../utils";
export class Node {
  id;
  type;
  childNode;
  title;
  content ;
  conditionNodes;
  constructor({ id, type, isRow, title, content }) {
    this.groupId = id;
    this.id = HashCode();
    this.type = type;
    // 设置标题
    if(title !== "" && title !== undefined) this.title =  title;
    else this.title = "请选择...";
    // 设置内容
    if(content !== "" && title !== undefined)  this.content = content;
    else this.content = "请点击填入具体信息...";
    this.isRow = isRow;
  }
}

/* 以下为七类商品
*  各自类型为：
*  钢丝绳：A
*  股：B
*  商品钢丝：C
*  制绳钢丝：D
*  热处理钢丝：E
*  初拉丝： F
*  预处理钢丝：G
*  原始盘条：H
*
*/

// 钢丝绳节点
export class WireRope extends Node {
  constructor({ id, type, isRow, title, content }) {
    super({ id, type, isRow, title, content });
  }
}

// 股
export class Strand extends Node{
  constructor({ id, type, isRow, title, content }) {
    super({ id, type, isRow, title, content });
  }
}

// 商品钢丝
export class CommercialWire extends Node {
  constructor({ id, type, isRow, title, content }) {
    super({ id, type, isRow, title, content });
  }
}

// 制绳钢丝
export class RopeMakingWire extends Node{
  constructor({ id, type, isRow, title, content }) {
    super({ id, type, isRow, title, content });
  }
}

// 热处理钢丝
export class HeatWire extends Node{
  constructor({ id, type, isRow, title, content }) {
    super({ id, type, isRow, title, content });
  }
}

// 初拉丝
export class DrawWire extends Node{
  constructor({ id, type, isRow, title, content }) {
    super({ id, type, isRow, title, content });
  }
}

// 原始盘条
export class Rod extends Node{
  constructor({ id, type, isRow, title, content }) {
    super({ id, type, isRow, title, content });
  }
}


export class ConditionNode {
  title = "title";
  data = {};
  constructor({ groupId, type, id, isRow }) {
    this.id = HashCode();
    this.groupId = groupId;
    this.type = type;
    this.content += this.id;
    this.groupPid = id;
    this.isRow = isRow;
  }
}
export class RowNode extends Node {
  data = {};
  constructor({ id, type, isRow }) {
    super({ id, type, isRow });
  }
}

export class CopyNode {
  title = "标题";
  id = HashCode();
  content = "内容";
  data = {};
  constructor({ id, childNode, ...node }) {
    return Object.assign(node, this);
  }
}
